#ifndef GYROL3G4200_H_
#define GYROL3G4200_H_

#include "..\System\F2806x_Device.h"

class GyroL3G4200
{
public:
	bool Init();
	void Update();

private:
	enum Registers
	{
		WhoAmI = 0x0F,
		Ctrl_Reg1 = 0x20,
		Ctrl_Reg2 = 0x21,
		Ctrl_Reg3 = 0x22,
		Ctrl_Reg4 = 0x23,
		Ctrl_Reg5 = 0x24,
		Status_Reg = 0x27,
		OutX_L = 0x28,
		OutX_H = 0x29,
		OutY_L = 0x2A,
		OutY_H = 0x2B,
		OutZ_L = 0x2C,
		OutZ_H = 0x2D
	};

	void SetupSPI();
	unsigned char WriteByte(unsigned char data);
	unsigned char ReadData(Registers regaddr);
	void WriteData(Registers regaddr, unsigned char data);

public:
	// [deg/s]
	float m_gyroX;
	float m_gyroY;
	float m_gyroZ;
};

#endif /* GYROL3G4200_H_ */
